package com.yili.oa.dao;

import com.yili.oa.models.UserExchange;
import com.yili.oa.models.UserExchangeExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface UserExchangeMapper {
    @SelectProvider(type=UserExchangeSqlProvider.class, method="countByExample")
    long countByExample(UserExchangeExample example);

    @DeleteProvider(type=UserExchangeSqlProvider.class, method="deleteByExample")
    int deleteByExample(UserExchangeExample example);

    @Delete({
        "delete from ft_user_exchange",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    @Insert({
        "insert into ft_user_exchange (id, order_id, ",
        "user_id, exchange_num, ",
        "time, status, bank_account, ",
        "bank_user, bank)",
        "values (#{id,jdbcType=INTEGER}, #{orderId,jdbcType=VARCHAR}, ",
        "#{userId,jdbcType=VARCHAR}, #{exchangeNum,jdbcType=REAL}, ",
        "#{time,jdbcType=BIGINT}, #{status,jdbcType=INTEGER}, #{bankAccount,jdbcType=VARCHAR}, ",
        "#{bankUser,jdbcType=VARCHAR}, #{bank,jdbcType=VARCHAR})"
    })
    int insert(UserExchange record);

    @InsertProvider(type=UserExchangeSqlProvider.class, method="insertSelective")
    int insertSelective(UserExchange record);

    @SelectProvider(type=UserExchangeSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="order_id", property="orderId", jdbcType=JdbcType.VARCHAR),
        @Result(column="user_id", property="userId", jdbcType=JdbcType.VARCHAR),
        @Result(column="exchange_num", property="exchangeNum", jdbcType=JdbcType.REAL),
        @Result(column="time", property="time", jdbcType=JdbcType.BIGINT),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @Result(column="bank_account", property="bankAccount", jdbcType=JdbcType.VARCHAR),
        @Result(column="bank_user", property="bankUser", jdbcType=JdbcType.VARCHAR),
        @Result(column="bank", property="bank", jdbcType=JdbcType.VARCHAR)
    })
    List<UserExchange> selectByExample(UserExchangeExample example);

    @Select({
        "select",
        "id, order_id, user_id, exchange_num, time, status, bank_account, bank_user, ",
        "bank",
        "from ft_user_exchange",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="order_id", property="orderId", jdbcType=JdbcType.VARCHAR),
        @Result(column="user_id", property="userId", jdbcType=JdbcType.VARCHAR),
        @Result(column="exchange_num", property="exchangeNum", jdbcType=JdbcType.REAL),
        @Result(column="time", property="time", jdbcType=JdbcType.BIGINT),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @Result(column="bank_account", property="bankAccount", jdbcType=JdbcType.VARCHAR),
        @Result(column="bank_user", property="bankUser", jdbcType=JdbcType.VARCHAR),
        @Result(column="bank", property="bank", jdbcType=JdbcType.VARCHAR)
    })
    UserExchange selectByPrimaryKey(Integer id);

    @UpdateProvider(type=UserExchangeSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") UserExchange record, @Param("example") UserExchangeExample example);

    @UpdateProvider(type=UserExchangeSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") UserExchange record, @Param("example") UserExchangeExample example);

    @UpdateProvider(type=UserExchangeSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(UserExchange record);

    @Update({
        "update ft_user_exchange",
        "set order_id = #{orderId,jdbcType=VARCHAR},",
          "user_id = #{userId,jdbcType=VARCHAR},",
          "exchange_num = #{exchangeNum,jdbcType=REAL},",
          "time = #{time,jdbcType=BIGINT},",
          "status = #{status,jdbcType=INTEGER},",
          "bank_account = #{bankAccount,jdbcType=VARCHAR},",
          "bank_user = #{bankUser,jdbcType=VARCHAR},",
          "bank = #{bank,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(UserExchange record);
}